<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 教务管理系统</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .login-container {
            background: rgba(255, 255, 255, 0.95);
            padding: 40px;
            border-radius: 12px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 400px;
            backdrop-filter: blur(10px);
        }

        .login-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .login-title {
            font-size: 28px;
            color: #333;
            margin-bottom: 10px;
            font-weight: bold;
        }

        .login-subtitle {
            color: #666;
            font-size: 16px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            display: block;
            margin-bottom: 8px;
            color: #333;
            font-weight: bold;
            font-size: 14px;
        }

        .form-input {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid #e1e5e9;
            border-radius: 8px;
            font-size: 16px;
            transition: border-color 0.3s, box-shadow 0.3s;
            background: white;
        }

        .form-input:focus {
            outline: none;
            border-color: #4285f4;
            box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
        }

        .form-input::placeholder {
            color: #999;
        }

        .login-options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            font-size: 14px;
        }

        .remember-me {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #666;
        }

        .remember-me input[type="checkbox"] {
            width: 16px;
            height: 16px;
        }

        .forgot-password {
            color: #4285f4;
            text-decoration: none;
            transition: color 0.3s;
        }

        .forgot-password:hover {
            color: #3367d6;
        }

        .login-btn {
            width: 100%;
            padding: 14px;
            background: linear-gradient(45deg, #4285f4, #34a853);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
        }

        .login-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
        }

        .login-btn:active {
            transform: translateY(0);
        }

        .login-btn:disabled {
            background: #ccc;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        .divider {
            text-align: center;
            margin: 25px 0;
            position: relative;
            color: #999;
        }

        .divider::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            height: 1px;
            background: #e1e5e9;
        }

        .divider span {
            background: rgba(255, 255, 255, 0.95);
            padding: 0 15px;
        }

        .demo-info {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 8px;
            border-left: 4px solid #4285f4;
            margin-top: 20px;
        }

        .demo-info h4 {
            color: #333;
            margin-bottom: 10px;
            font-size: 14px;
        }

        .demo-info p {
            color: #666;
            font-size: 13px;
            margin: 5px 0;
        }

        .demo-info .demo-account {
            background: white;
            padding: 8px;
            border-radius: 4px;
            font-family: monospace;
            font-size: 12px;
            margin: 5px 0;
        }

        .error-message {
            background: #f8d7da;
            color: #721c24;
            padding: 10px;
            border-radius: 6px;
            margin-bottom: 15px;
            font-size: 14px;
            display: none;
        }

        .success-message {
            background: #d4edda;
            color: #155724;
            padding: 10px;
            border-radius: 6px;
            margin-bottom: 15px;
            font-size: 14px;
            display: none;
        }

        /* 响应式设计 */
        @media (max-width: 480px) {
            .login-container {
                margin: 20px;
                padding: 30px 25px;
            }

            .login-title {
                font-size: 24px;
            }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-header">
            <h1 class="login-title">教务管理系统</h1>
            <p class="login-subtitle">请登录您的账户</p>
        </div>

        <form id="loginForm">
            <div id="errorMessage" class="error-message"></div>
            <div id="successMessage" class="success-message"></div>

            <div class="form-group">
                <label class="form-label" for="username">用户名</label>
                <input
                    type="text"
                    id="username"
                    name="username"
                    class="form-input"
                    placeholder="请输入用户名"
                    required
                >
            </div>

            <div class="form-group">
                <label class="form-label" for="password">密码</label>
                <input
                    type="password"
                    id="password"
                    name="password"
                    class="form-input"
                    placeholder="请输入密码"
                    required
                >
            </div>

            <div class="login-options">
                <label class="remember-me">
                    <input type="checkbox" id="rememberMe" name="rememberMe">
                    <span>记住我</span>
                </label>
                <a href="#" class="forgot-password">忘记密码？</a>
            </div>

            <button type="submit" class="login-btn" id="loginBtn">
                登录
            </button>
        </form>

        <div class="divider">
            <span>演示信息</span>
        </div>

        <div class="demo-info">
            <h4>🔐 演示账户信息</h4>
            <p><strong>用户名:</strong></p>
            <div class="demo-account">user</div>
            <p><strong>密码:</strong></p>
            <div class="demo-account">4643045b-02d3-4d5f-91f3-30f490856047</div>
            <p style="margin-top: 10px; font-size: 12px; color: #999;">
                ⚠️ 这是Spring Security自动生成的临时密码，每次重启应用会重新生成
            </p>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const loginForm = document.getElementById('loginForm');
            const loginBtn = document.getElementById('loginBtn');
            const errorMessage = document.getElementById('errorMessage');
            const successMessage = document.getElementById('successMessage');

            // 表单提交处理
            loginForm.addEventListener('submit', function(e) {
                e.preventDefault();

                const username = document.getElementById('username').value.trim();
                const password = document.getElementById('password').value;

                if (!username || !password) {
                    showError('请输入用户名和密码');
                    return;
                }

                // 禁用登录按钮
                loginBtn.disabled = true;
                loginBtn.textContent = '登录中...';

                // 模拟登录过程
                setTimeout(() => {
                    if (username === 'user' && password === '4643045b-02d3-4d5f-91f3-30f490856047') {
                        showSuccess('登录成功，正在跳转...');
                        setTimeout(() => {
                            window.location.href = 'index.html';
                        }, 1000);
                    } else {
                        showError('用户名或密码错误');
                        loginBtn.disabled = false;
                        loginBtn.textContent = '登录';
                    }
                }, 1000);
            });

            // 显示错误信息
            function showError(message) {
                errorMessage.textContent = message;
                errorMessage.style.display = 'block';
                successMessage.style.display = 'none';
            }

            // 显示成功信息
            function showSuccess(message) {
                successMessage.textContent = message;
                successMessage.style.display = 'block';
                errorMessage.style.display = 'none';
            }

            // 快速填充演示账户
            document.querySelector('.demo-account').addEventListener('click', function() {
                document.getElementById('username').value = 'user';
            });

            document.querySelectorAll('.demo-account')[1].addEventListener('click', function() {
                document.getElementById('password').value = '4643045b-02d3-4d5f-91f3-30f490856047';
            });
        });
    </script>
</body>
</html>
